﻿<%@ Page Title="Delivery Order" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="CreateDO.aspx.cs" Inherits="VSM.CreateDO" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function isNumberKey(sender, evt) {
            var txt = sender.value;
            var dotcontainer = txt.split('.');
            var charCode = (evt.which) ? evt.which : event.keyCode;
            if (!(dotcontainer.length == 1 && charCode == 46) && charCode > 31 && (charCode < 48 || charCode > 57))
                return false;
            return true;
        }

        function OpenItemPopup() {
            //var customer = $("#<%= txtCustomerCode.ClientID %>").val();
            var url = "../../ItemPopup.aspx?itmgrp=104";
            Main.openCustomDialog(url, 600, 610, "Accessories - Item Master Data");
        }

        function OpenBP() {
            var url = "../../BPPopup.aspx?CardType=C";
            Main.openCustomDialog(url, 600, 610, "Business Partner List");
        }

        function OpenDocList(docktype, title, status) {
            var url = "../../DocumentList.aspx?DocType=" + docktype + "&Status=" + status
            Main.openCustomDialog(url, 800, 610, title);
        }

        function OpenFreight() {
            var url = "FreightPopup.aspx";
            Main.openCustomDialog(url, 800, 610, "Other Fees");
        }

        function OpenOSRI(itemCode, whsCode, docLineNum) {
            var url = "VINNumberPopup.aspx?ItemCode=" + itemCode;
            url += "&WhsCode=" + whsCode;
            url += "&DocLineNum=" + docLineNum;
            Main.openCustomDialog(url, 800, 610, "VIN Number List");
        }

        function OpenMain() {
            var docentry = $("#<%= txtDONo.ClientID %>").val();
            var dimensions = 'directories=no,titlebar=yes,toolbar=no,location=1,status=yes,menubar=no,scrollbars=yes,resizable=yes,height=620 ,width= 850 ';
            if (navigator.appName != "Microsoft Internet Explorer") {
                window.opener = self;
            }
            else {
                window.opener = true;
            }

            window.open('', '_self');
            var newWindow = window.open('../Printing/FormPrinting.aspx?DocEntry=' + docentry + '&DocType=15', '_blank', dimensions);
            if (isIE() == 8) {
                newWindow.location.href = '../Printing/FormPrinting.aspx?DocEntry=' + docentry + '&DocType=15'
            }
            window.moveTo(0, 0);
            window.resizeTo(screen.width, screen.height - 100);
        }
        function isIE() {
            var myNav = navigator.userAgent.toLowerCase();
            return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
        }

    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:HiddenField ID="hdnIsUpdate" runat="server" />
                <asp:HiddenField ID="hdnStatus" runat="server" />
                <asp:HiddenField ID="hdnSlpCode" runat="server" />
                <asp:HiddenField ID="hdnBaseType" runat="server" />
                <h2>
                    &nbsp;<asp:Label ID="lblTitle" runat="server" Text="Delivery Order"></asp:Label>
                </h2>
                <div style="margin-left: 5px; width: 99%;">
                    <hr />
                    <table border="0" width="100%" style="background-color: #D1D4D8; font-weight: bold;">
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                <asp:Label ID="lblDONo" runat="server" Text="DO. No:"></asp:Label>
                            </td>
                            <td style="width: 200px;">
                                <asp:TextBox ID="txtDONo" runat="server" BackColor="#E6E6E6" ReadOnly="True" Width="60px" ></asp:TextBox>
                            </td>
                            <td width="100px" style="width: 210px; border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                <asp:Label ID="lblStatusName" runat="server" Text="Status:"></asp:Label>
                            </td>
                            <td align="left">
                                <asp:Label ID="lblStatus" runat="server" Text="Open"></asp:Label>
                            </td>
                            <td align="right" >
                                <asp:Button ID="btnDocList" runat="server" OnClientClick="OpenDocList('15', 'Delivery Order List', ''); return false;" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" Text="List" Width="60px" />
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 150px; border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                <asp:Label ID="lblPostingDate" runat="server" Text="Posting Date:"></asp:Label>
                            </td>
                            <td style="width: 200px">
                                <asp:TextBox ID="txtPostingDate" runat="server" AutoPostBack="True" Width="100px" OnTextChanged="txtPODate_TextChanged"></asp:TextBox>
                                <asp:ImageButton ID="Image1" runat="Server" AlternateText="Click to show calendar"
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtPostingDate"
                                    PopupButtonID="Image1" Format="dd/MM/yyyy">
                                </cc1:CalendarExtender>
                                <asp:Label ID="lblPosDateRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                <asp:Label ID="lblDocDate" runat="server" Text="Document Date:"></asp:Label>
                            </td>
                            <td colspan="2">
                                <asp:TextBox ID="txtDocDate" runat="server" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtDocDate_CalendarExtender" runat="server" 
                                    Format="dd/MM/yyyy" PopupButtonID="imgDocDate" TargetControlID="txtDocDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgDocDate0" runat="Server" 
                                    AlternateText="Click to show calendar" 
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                <asp:Label ID="lblDocDateRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td valign="middle" style="border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                <asp:Label ID="lblDelDate" runat="server" Text="Delivery Date:"></asp:Label>
                            </td>
                            <td style="" valign="top">
                                <asp:TextBox ID="txtDeliveryDate" Width="100px" runat="server"></asp:TextBox>
                                <asp:ImageButton ID="ImageButton1" runat="Server" AlternateText="Click to show calendar" ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtDeliveryDate"
                                    PopupButtonID="ImageButton1" Format="dd/MM/yyyy">
                                </cc1:CalendarExtender>
                                <asp:Label ID="lblDelDateRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                <asp:Label ID="lblSONo" runat="server" Text="SO. No:"></asp:Label>
                            </td>
                            <td colspan="2">
                                <asp:TextBox ID="txtSONo" runat="server" BackColor="#E6E6E6" ReadOnly="True" 
                                    Width="100px"></asp:TextBox>
                                <asp:Label ID="lblExtension" runat="server" Text="Ext.:"></asp:Label>
                                <asp:Label ID="lblExtText" runat="server">A</asp:Label>
                            </td>
                        </tr>
                    </table>
                    <table id="Table1" width="100%" style="font-weight: bold">
                        <tr>
                            <td class="FormLineItemAlt" style="width: 100px;">
                                <asp:Label ID="lblCustomerInfo" runat="server" Text="Customer:"></asp:Label>
                            </td>
                            <td class="FormLineItemAlt" style="white-space: nowrap;" valign="middle">
                                <asp:TextBox ID="txtCustomerCode" runat="server" ReadOnly="True" style="width: 13%;" BackColor="#E6E6E6"></asp:TextBox>
                                <asp:TextBox ID="txtCustomerName" runat="server" style="width: 35%;" 
                                    BackColor="#E6E6E6" ReadOnly="True"></asp:TextBox>
                                <asp:Button ID="btnSelectBP" runat="server" OnClientClick="OpenBP(); return false;"
                                    Text="..." Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; font-weight: bold" />
                                <asp:Label ID="lblCustomerRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItem" style="width: 100px;">
                                <asp:Label ID="lblConPersonName" Width="100px" Text="Contact Person:" runat="server"></asp:Label>
                            </td>
                            <td class="FormLineItem" valign="middle">
                                <asp:TextBox ID="txtContactPerson" runat="server" style="width: 48%;"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItemAlt" valign="middle" colspan="2">
                                <asp:Button ID="btnAddItems" runat="server" Text="Add vehicle"                                    
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    Width="75px" onclick="btnAddItems_Click" Enabled="False" />                            
                                <asp:Button ID="btnAddAccessories" runat="server" Enabled="False" 
                                    OnClientClick="OpenItemPopup();return false;" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    Text="Add accessories" Width="105px" />
                                <asp:Button ID="btnGetTemplate" runat="server" onclick="btnGetTemplate_Click" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    text="Get Template" Width="90px" />
                                <asp:FileUpload ID="FileUploadControl" runat="server" />
                                <asp:Button ID="btnImport" runat="server" onclick="btnImport_Click" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    text="Import" Width="60px" />
                            </td>
                        </tr>
                    </table>
                    <hr />
                    <div style="width: 100%">
                        <asp:GridView ID="grvSO" CssClass="GridInner" runat="server" Width="100%" BorderColor="White"
                            BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                            HeaderStyle-Height="27px" OnRowCreated="grvSO_RowCreated" CellSpacing="2" HeaderStyle-VerticalAlign="Middle"
                            HeaderStyle-HorizontalAlign="Center" AllowPaging="True" OnPageIndexChanging="grvSearchResult_PageIndexChanging" 
                            PageSize="20" OnRowDataBound="grvSearchResult_RowDataBound">
                            <PagerSettings Mode="NumericFirstLast" />
                            <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                            <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                            <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                            <Columns>
                                <asp:CommandField HeaderText="Action" ShowDeleteButton="True" ShowEditButton="False"
                                    Visible="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    ItemStyle-Width="70px" />
                                <asp:TemplateField HeaderText="Action">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkDelete" runat="server" Text="Delete" TabIndex="-1" OnClick="lnkDelete_Click"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="#">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblNo" runat="server" Text='<%# Bind("No") %>' BorderStyle="none">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Model/ Product">
                                    <ItemStyle HorizontalAlign="Center" Width="170px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlModel" AutoPostBack="true" onselectedindexchanged="ddlModel_SelectedIndexChanged" style="width: 98%;" runat="server" >
                                        </asp:DropDownList>
                                        <asp:DropDownList ID="ddlProduct" AutoPostBack="true" onselectedindexchanged="ddlProduct_SelectedIndexChanged" style="width: 98%;" runat="server" >
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Color">
                                    <ItemStyle HorizontalAlign="Center" Width="190px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlColor" AutoPostBack="true" onselectedindexchanged="ddlColor_SelectedIndexChanged" style="width: 98%;" runat="server" >
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Item Code" Visible="false">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblItemCode" runat="server" Text='<%# Bind("ItemCode") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Item Name">
                                    <ItemStyle HorizontalAlign="left" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <HeaderTemplate>
                                        <asp:label ID="lblHeaderItemName" runat="Server" Text="Item Name" />
                                        <asp:label ID="lblItemNameRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="txtItemName" runat="server" Text='<%# Bind("Dscription") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="VIN Number">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" Width="50px" />
                                    <HeaderTemplate>
                                        <asp:label ID="lblHeaderQty" runat="Server" Text="VIN Number" />
                                        <asp:label ID="lblQtyRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkOSRI" runat="server" OnClick="lnkOSRI_Click" >
                                        <img src="../../skin/icon/link.png" alt="icon"/></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Model" Visible="false">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtModel" runat="server" Text='<%# Bind("U_Model") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Product" Visible="false">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtProduct" runat="server" Text='<%# Bind("U_Product") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Color" Visible="false">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtCorlorCode" runat="server" Text='<%# Bind("U_Color") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Qty./ Unit price">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <HeaderTemplate>
                                        <asp:label ID="lblHeaderQty" runat="Server" Text="Qty./ Unit price" />
                                        <asp:label ID="lblQtyRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtOrderQuantity" runat="server" Width="97%" Text='<%# Bind("Quantity") %>' AutoPostBack="true" 
                                            OnKeyPress="return isNumberKey(this, event);" Style="text-align: right" OnTextChanged="txtOrderQuantity_OnTextChanged"/>
                                        <asp:TextBox ID="txtUnitPrice" runat="server" Style="text-align: right; width: 98%;" Text='<%# Bind("PriceBefDi") %>' BackColor="Transparent"
                                            AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" OnTextChanged="txtUnitPrice_OnTextChanged" ReadOnly="true" BorderStyle="None" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 
                                <asp:TemplateField HeaderText="Total Before Disc.">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtLineTotal" runat="server" Text='<%# Bind("LineTotal") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Disc. Amnt/ Incentive Disc.">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtDiscount" runat="server" Width="97%" Style="text-align: right" ReadOnly="true" BackColor="Transparent" BorderStyle="None"
                                            Text='<%# Bind("U_Discount") %>' OnKeyPress="return isNumberKey(this, event);" AutoPostBack="true" OnTextChanged="txtDiscount_OnTextChanged" />
                                        <asp:TextBox ID="txtIncentiveDsc" runat="server" Width="97%" Style="text-align: right" ReadOnly="true" BackColor="Transparent" BorderStyle="None"
                                            Text='<%# Bind("U_IncentiveDiscount") %>' AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" OnTextChanged="txtIncentiveDsc_OnTextChanged" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Total After Disc.">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtTotalAfter" runat="server" Text='<%# Bind("TotalAfDisc") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Tax">
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlVatGroup" AutoPostBack="true" OnSelectedIndexChanged="ddlVatGroup_SelectedIndexChanged" Enabled="false" 
                                            Style="width: 98%;" runat="server" BackColor="Transparent" />
                                        <asp:HiddenField ID="hdnVatGroup" Value='<%# Bind("VatGroup") %>' runat="server" />
                                        <asp:HiddenField ID="hdnVatPrcnt" Value='<%# Bind("VatPrcnt") %>' runat="server" />
                                        <asp:HiddenField ID="hdnVatSum" Value='<%# Bind("VatSum") %>' runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Warehouse">
                                    <ItemStyle HorizontalAlign="Center" Width="130px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlWhs" AutoPostBack="true" OnSelectedIndexChanged="ddlWhs_SelectedIndexChanged" Enabled="false"
                                            Style="width: 98%;" runat="server" BackColor="Transparent" />
                                        <asp:HiddenField ID="hdnWhsCode" Value='<%# Bind("WhsCode") %>' runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Ship Date" >
                                    <HeaderStyle VerticalAlign="Middle" Width="80px" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderTemplate>
                                        <asp:label ID="lblHeaderShipDate" runat="Server" Text="Ship Date" />
                                        <asp:label ID="lblHeaderShipDateRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtShipDate" style="Width: 98%; text-align:center;" runat="server" Text='<%# Bind("ShipDate", "{0:dd/MM/yyyy}")%>'
                                            OnTextChanged="txtShipDate_OnTextChanged" AutoPostBack="true" ReadOnly="true" BackColor="Transparent" BorderStyle="None"/>
                                       <%-- <asp:ImageButton ID="imgShipDate" runat="Server" AlternateText="Click to show calendar"
                                            ImageUrl="~/Images/Calendar_scheduleHS.png" />--%>
                                        <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtShipDate" PopupButtonID="imgShipDate" Format="dd/MM/yyyy">
                                        </cc1:CalendarExtender>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Line Total">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtTotal" runat="server" Text='<%# Bind("Total") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Base Entry" Visible="false">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblBaseEntry" runat="server" Text='<%# Bind("BaseEntry") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Base Type" Visible="false">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblBaseType" runat="server" Text='<%# Bind("BaseType") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Base Line" Visible="false">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblBaseLine" runat="server" Text='<%# Bind("BaseLine") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <HeaderStyle BackColor="#6095C9" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False"
                                Height="27px" VerticalAlign="Bottom" />
                            <EmptyDataTemplate>
                                <table class="GridInner" style="width: 100%; border-color: White; text-align: center;" border="1" rules="all" cellspacing="2" cellpadding="2">
                                    <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none; background-color: rgb(96, 149, 201);">
                                        <th>
                                            <span>Action</span>
                                        </th>
                                        <th>
                                            <span>#</span>
                                        </th>
                                        <th>
                                            <span>Model/ Product</span>
                                        </th>
                                        <th>
                                            <span>Color</span>
                                        </th>
                                        <th>
                                            <span>Item Name</span>
                                        </th>
                                        <th>
                                            <span>VIN Number</span>
                                        </th>
                                         <th>
                                            <span>Qty./ Unit price</span>
                                        </th>
                                        <th>
                                            <span>Total Before Disc.</span>
                                        </th>
                                        <th>
                                            <span>Disc. Amnt/ Incentive Disc.</span>
                                        </th>
                                        <th>
                                            <span>Total After Disc.</span>
                                        </th>
                                        <th>
                                            <span>Tax</span>
                                        </th>
                                        <th>
                                            <span>Warehouse</span>
                                        </th>
                                        <th>
                                            <span></span>
                                        </th>
                                        <th>
                                            <span>Ship Date</span>
                                        </th>
                                        <th>
                                            <span>Line Total</span>
                                        </th>
                                    </tr>
                                    <tr>
                                        <td colspan="14">
                                            <span>No Data</span>
                                        </td>
                                    </tr>
                                </table>
                            </EmptyDataTemplate>
                        </asp:GridView>
                    </div>
                    <hr width="100%" />
                </div>
                <table width="100%" border="0">
                    <tr>
                        <td valign="top" style="width: 70%;">
                            <table style="width: 100%;">
                                <tr>
                                    <td valign="top" style="width: 10%;">
                                        <strong>
                                            <asp:Label ID="lblRemark" runat="server" Text="Remarks:"></asp:Label>
                                        </strong>
                                    </td>
                                    <td style="width: 50%;">
                                        <asp:TextBox runat="server" ID="txtRemarks" Height="71px" TextMode="MultiLine" style=" width: 98%;"></asp:TextBox>
                                    </td>
                                    <td valign="top" style="width: 10%;">
                                        <strong>
                                            <asp:Label ID="lblSaleMan" runat="server" Text="Sale Man:"></asp:Label>
                                        </strong>
                                    </td>
                                    <td valign="top" style="width: 30%;">
                                        <asp:DropDownList ID="ddlSaleMan" style=" width: 100%;" runat="server"></asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td style="width: 30%">
                            <div style="margin-right: 1px;">
                                <table border="0" width="100%">
                                    <tr valign="middle" style="height: 27px; color: black; font-weight: bold; text-decoration: none; background-color: #D9E0ED;">
                                        <td style="width: 50%" align="right">
                                            <asp:Label ID="lblSubTotalName" runat="server" Text="Sub Total:"></asp:Label>
                                        </td>
                                        <td style="width: 50%" align="right">
                                            <asp:Label ID="lblSubTotal" Width="98%" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none; background-color: rgb(96, 149, 201);">
                                        <td style="width: 50%" align="right">
                                            <asp:Label ID="lblTaxAmountName" runat="server" Text="Tax Amount:"></asp:Label>
                                        </td>
                                        <td style="width: 50%" align="right">
                                            <asp:Label ID="lblTaxAmount" Width="98%" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
<%--                                    <tr valign="middle" style="height: 27px; font-weight: bold; text-decoration: none; background-color: #D9E0ED;">
                                        <td style="width: 50%" align="right">
                                            <asp:Label ID="lblOtherFeesName" runat="server" Text="Other Fees:"></asp:Label>
                                        </td>
                                        <td style="width: 50%" align="right">
                                            <asp:Label ID="lblOtherFees" Width="98%" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>--%>
                                    <tr valign="middle" style="height: 27px; font-weight: bold; text-decoration: none; background-color: #D9E0ED;">
                                        <td style="width: 50%" align="right">
                                            <asp:Label ID="lblGrandTotalName" runat="server" Text="Grand Total:"></asp:Label>
                                        </td>
                                        <td style="width: 50%" align="right">
                                            <asp:Label ID="lblPaymentTotal" Width="98%" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div style="margin-left: 5px; width: 99%;">
                                <hr />
                            </div>
                            <table style="width: 100%">
                                <tr>
                                    <td style="width: 350px;">
                                        <asp:Button ID="btnSave" runat="server" Text="Save" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnSave_Click"  OnClientClick="return confirm('Are you sure? After saved, you cannot edit anythings in this DO.');"
                                            BorderStyle="Solid" Width="60px" Enabled="False" />
                                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" BorderStyle="Solid" 
                                            OnClick="btnCancel_Click" Width="60px" Enabled="False" />
                                        <asp:Button ID="btnPrintContract" runat="server" BorderStyle="Solid" 
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; color: White;" 
                                            Text="Print Contract" Width="95px" onclick="btnPrintContract_Click" 
                                            Visible="False" />

                                        <asp:Button ID="btnPrint" runat="server" BorderStyle="Solid" Enabled="False" 
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; color: White;" 
                                            Text="Print DO." Width="60px" onclick="btnPrint_Click" />
                                        <asp:Button ID="btnLastRecord" runat="server" BorderStyle="Solid" 
                                            Enabled="False" OnClick="btnLastRecord_Click" 
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; color: White;" 
                                            Text="&gt;&gt;" Width="40px" />
                                    </td>
                                    <td>
                                        <asp:Label ID="lblError" runat="server" Visible="False" Font-Bold="True" ForeColor="Red"></asp:Label>
                                    </td>
                                    <td align="right" style="width: 305px;">
                                        <asp:Button ID="btnCopyFrom" runat="server" Text="Copy from Sales Order" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" 
                                            OnClientClick="OpenDocList('17', 'Sales Order List', 'O'); return false;" BorderStyle="Solid" 
                                            Width="140px" Enabled="False" />
                                        <asp:Button ID="btnCopyTo" runat="server" Text="Copy to A/R Invoice" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnCopyTo_Click" 
                                            BorderStyle="Solid" Width="135px" Enabled="False" />
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
            <Triggers>
                <asp:PostBackTrigger  ControlID="btnImport" />
                 <asp:PostBackTrigger  ControlID="btnGetTemplate" />
                 <asp:PostBackTrigger  ControlID="btnPrintContract" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
